<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <a href="test.pdf" target="_blank">打开pdf</a>

    <script>
        const downloadform = (url, token) => {
            var form = document.createElement("form");
            var input = document.createElement("input");
            // input.name = "token";
            // input.value = token;
            form.action = url;
            form.method = "get";
            form.style.display = "none";
            document.body.appendChild(form);
            form.appendChild(input);
            form.submit();
            document.body.removeChild(form);
        };
        // downloadform('/download/pdf')
        // fetch('test.pdf').then(res => res.blob()).then((blobObj) => {
        //     const url = URL.createObjectURL(blobObj)
        //     console.log(url)
        //     downloadform(url)
        // })
    </script>
</body>

</html>